<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> UDT Reference</title>
<link rel="stylesheet" href="udtdoc.css" type="text/css" />
<style type="text/css">
<!--
.style1 {
	color: #0000FF;
	font-style: italic;
}
-->
</style>
</head>

<body>
<div class="ref_head">&nbsp;UDT Reference: Structures</div>

<h3><font color="#000080">UDT Socket Structures</font></h3>

<p>The structures used in UDT API are listed in the table below:</p>

<table width="100%" border="1" cellpadding="1" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
    <td width="17%" class="table_headline"><strong>Structures</strong></td>
    <td width="83%" class="table_headline"><strong>Comments</strong></td>
  </tr>
  <tr>
    <td><a href="#1">UDTSOCKET</a></td>
    <td>UDT socket descriptor</td>
  </tr>
  <tr>
    <td><a href="#2">ERRORINFO</a></td>
    <td>Description of UDT system errors</td>
  </tr>
  <tr>
    <td><a href="#3">UDSET</a></td>
    <td>Set of UDT sockets</td>
  </tr>
  <tr>
    <td><a href="#4">TRACEINFO</a></td>
    <td>UDT performance statistics and protocol parameters</td>
  </tr>
</table>

<h5><a name="1" id="1"></a>UDTSOCKET</h5>
<p>This is used as the descriptor of a UDT socket. Its internal is not exposed to application and subject to future changes.</p>

<h5><a name="2" id="2"></a>ERRORINFO</h5>
<p>The ERRORINFO structure contains the specific information of a UDT error. It has two helper functions to let applications know an integral error code and a piece of text information.</p>
<table width="100%" border="1" cellpadding="1" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
    <td width="30%" class="table_headline"><strong>Functions</strong></td>
    <td width="70%" class="table_headline"><strong>Comments</strong></td>
  </tr>
  <tr>
    <td>int getErrorCode()</td>
    <td>read the UDT error code</td>
  </tr>
  <tr>
    <td>const char* getErrorMessage()</td>
    <td>read the text information about the error.</td>
  </tr>
  <tr>
    <td>void clear()</td>
    <td>clear the error information (set to SUCCESS).</td>
  </tr>
</table>

<h5><a name="3" id="3"></a>UDSET</h5>
<p>The UDSET structure is used with <a href="select.htm"><strong>select</strong></a> call to access multiple UDT descriptors.</p>
<p>Four macros are defined on the UDSET structure to processing a UDT socket set. They are very similar to the fd_set structure and macros in traditional standard socket API.</p>

<table width="100%" border="1" cellpadding="1" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
    <td width="30%" class="table_headline"><strong>Macros</strong></td>
    <td width="70%" class="table_headline"><strong>Comments</strong></td>
  </tr>
  <tr>
    <td>UD_CLR(<em>u</em>, *<em>set</em>)</td>
    <td>remove socket <em>u</em> from <em>set</em>.</td>
  </tr>
  <tr>
    <td>UD_ISSET(u, *set)</td>
    <td>check if <em>u</em> is in <em>set</em>.</td>
  </tr>
  <tr>
    <td>UD_SET(<em>u</em>, *<em>set</em>)</td>
    <td>add <em>u</em> into the <em>set.</em></td>
  </tr>
  <tr>
    <td>UD_ZERO(*<em>set</em>)</td>
    <td>initialize <em>set</em> to empty.</td>
  </tr>
</table>

<h5><a name="4" id="4"></a>TRACEINFO</h5>
<p>The TRACEINFO structure stores the performance trace information. Its member attributes can be read directly by applications.</p>

<table width="100%" border="1" cellpadding="1" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
    <td width="17%" class="table_headline"><strong>Members</strong></td>
    <td width="83%" class="table_headline"><strong>Comments</strong></td>
  </tr>
  <tr>
    <td colspan="2"><span class="style1">The following attributes are aggregate values since the UDT socket is created.</span></td>
  </tr>
  <tr>
    <td>int64_t msTimeStamp</td>
    <td>time elapsed since the UDT socket is created, in milliseconds</td>
  </tr>
  <tr>
    <td>int64_t pktSentTotal</td>
    <td>total number of sent packets, including retransmissions</td>
  </tr>
  <tr>
    <td>int64_t pktRecvTotal</td>
    <td>total number of received packets</td>
  </tr>
  <tr>
    <td>int pktSndLossTotal</td>
    <td>total number of lost packets, measured in the sending side</td>
  </tr>
  <tr>
    <td>int pktRcvLossTotal</td>
    <td>total number of lost packets, measured in the receiving side</td>
  </tr>
  <tr>
    <td>int pktRetransTotal</td>
    <td>total number of retransmitted packets, measured in the sending side</td>
  </tr>
  <tr>
    <td>int pktSentACKTotal</td>
    <td>total number of sent ACK packets</td>
  </tr>
  <tr>
    <td>int pktRecvACKTotal</td>
    <td>total number of received ACK packets</td>
  </tr>
  <tr>
    <td>int pktSentNAKTotal</td>
    <td>total number of sent NAK packets</td>
  </tr>
  <tr>
    <td>int pktRecvNAKTotal</td>
    <td>total number of received NAK packets</td>
  </tr>
  <tr>
    <td colspan="2"><span class="style1">The following attributes are local values since the last time they are recorded.</span></td>
  </tr>
  <tr>
    <td>int64 pktSent</td>
    <td>number of sent packets, including retransmissions</td>
  </tr>
  <tr>
    <td>int64 pktRecv</td>
    <td>number of received packets</td>
  </tr>
  <tr>
    <td>int pktSndLoss</td>
    <td>number of lost packets, measured in the sending side</td>
  </tr>
  <tr>
    <td>int pktRcvLoss</td>
    <td>number of lost packets, measured in the receiving side</td>
  </tr>
  <tr>
    <td>int pktRetrans</td>
    <td>number of retransmitted packets, measured in the sending side</td>
  </tr>
  <tr>
    <td>int pktSentACK</td>
    <td>number of sent ACK packets</td>
  </tr>
  <tr>
    <td>int pktRecvACK</td>
    <td>number of received ACK packets</td>
  </tr>
  <tr>
    <td>int pktSentNAK</td>
    <td>number of sent NAK packets</td>
  </tr>
  <tr>
    <td>int pktRecvNAK</td>
    <td>number of received NAK packets</td>
  </tr>
  <tr>
    <td>double mbpsSendRate</td>
    <td>sending rate in Mbps</td>
  </tr>
  <tr>
    <td>double mbpsRecvRate</td>
    <td>receiving rate in Mbps</td>
  </tr>
  <tr>
    <td colspan="2"><span class="style1">The following attributes are instant values at the time they are observed.</span></td>
  </tr>
  <tr>
    <td>double usPktSndPeriod</td>
    <td>packet sending period, in microseconds</td>
  </tr>
  <tr>
    <td>int pktFlowWindow</td>
    <td>flow window size, in number of packets</td>
  </tr>
  <tr>
    <td>int pktCongestionWindow</td>
    <td>congestion window size, in number of packets</td>
  </tr>
  <tr>
    <td>int pktFlightSize</td>
    <td>number packets on the flight</td>
  </tr>
  <tr>
    <td>double msRTT</td>
    <td>round trip time, in milliseconds</td>
  </tr>
  <tr>
    <td>double mbpsBandwidth</td>
    <td>estimated bandwidth, in Mbps</td>
  </tr>
  <tr>
    <td>int byteAvailSndBuf</td>
    <td>available sending buffer size, in bytes</td>
  </tr>
  <tr>
    <td>int byteAvailRcvBuf</td>
    <td>available receiving buffer size, in bytes</td>
  </tr>
</table>

<h5>See Also</h5>
<p><strong><a href="structure.htm">UDT Socket Structures</a></strong></p>

<p>&nbsp;</p>

</body>
</html>
